import React, { Component } from "react";
// import PropTypes from "prop-types";
import { number, string, oneOf } from "prop-types";
//todo https://www.npmjs.com/package/prop-types

class Header extends Component {
  static propTypes = {
    count: number,
  };
  render() {
    const { count } = this.props;
    return <div>这是头部 - {count}</div>;
  }
}
// Header.propTypes = {
//   count: PropTypes.number,
// };

const Footer = ({ name }) => {
  return <div>这是底部 - {name}</div>;
};
Footer.propTypes = {
  name: string.isRequired,
  sex: oneOf(["男", "女"]),
};

class App extends Component {
  render() {
    return (
      <>
        <h2>检查props的类型</h2>
        <Header count={4} />
        <Footer name="zhangmou" sex="男" />
      </>
    );
  }
}

export default App;
